{% load blog_tags %}
<!-- 文章分类 -->
<div class="card mt-3" style="width: 18rem;">
    <div class="card-header">
        文章分类
    </div>

    <ul class="list-group list-group-flush">
        {% get_category_list as category_list %}
        {% for category in category_list %}
        <li class="list-group-item d-flex justify-content-between align-items-center">
            <a class="link-warning" href="{{ category.get_absolute_url }}">{{ category.name }}</a>
            <span class="badge bg-info px-3">{{ category.total_num }}</span>
        </li>
        {% empty %}
        <li class="list-group-item">暂无分类</li>
        {% endfor %}
    </ul>
</div>

<!-- 文章标签 -->
<div class="card mt-3" style="width: 18rem;">
    <div class="card-header">
        文章标签
    </div>

    <div class="card-body">
        {% get_tag_list as tag_list %}
        {% for tag in tag_list %}
        <a class="badge {% cycle 'bg-success' 'bg-primary' 'bg-secondary' %}" href="{{ tag.get_absolute_url }}">
            {{ tag.name }} {{ tag.total_num }}
        </a>
        {% empty %}
        <li class="list-group-item">暂无标签</li>
        {% endfor %}
    </div>
</div>
